import mimetypes
import os
import time

from django.http import HttpResponse
from django.shortcuts import render


def handelFile(request, path):
    type, encoding = mimetypes.guess_type(path)
    return HttpResponse(open("assets/" + path, "rb"), content_type=type)


def policy(request):
    if request.GET.get("type") == "0":
        return render(request, "privacy_policy.html")
    else:
        return render(request, "service_items.html")


def gitpull(req):
    os.system("git reset --hard")
    os.system("git pull")
    return HttpResponse(str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())))